package com.custom.action.joiner.interfaces;

import com.custom.comm.utils.Constants;

import java.util.function.Predicate;
import java.util.function.Supplier;

/**
 * 做一些事
 * @author Xiao-Bai
 * @since 2023/4/30 18:27
 */
public interface DoSomething {

    /**
     * 获取执行后的内容
     */
    String getSomething();

    /**
     * 是否添加
     */
    default DoSomething isAdd(boolean condition) {
        return () -> condition ? getSomething() : Constants.EMPTY;
    }

    /**
     * 连接下一步要做的事
     */
    default DoSomething nextDoing(DoSomething something) {
        return () -> something.getSomething() + this.getSomething();
    }

    /**
     * 连接上一步要做的事
     */
    default DoSomething prevDoing(DoSomething something) {
        return () -> this.getSomething() + something.getSomething();
    }

}
